/*
 * ODO: Real-Time In-Memory ORM/DBMS Grid software
 * Copyright (c) 2008, Michael Oksenenko
 * All rights reserved.
 */
#ifndef PROCESS_FACTORY_HPP
#define PROCESS_FACTORY_HPP

#include "OsConfig.hpp"

#include "OsComponentFactoryIF.hpp"
#include "ProcessIF.hpp"
#include "ProcessLinux.hpp"
#include "ProcessVista.hpp"

#include <memory>

namespace odo {

template<unsigned OS>
class ProcessFactory : public OsComponentFactoryIF<ProcessIF> {

public: // iface

	virtual std::auto_ptr<ProcessIF> getComponent() = 0;

public: // factory

	virtual ~ProcessFactory() { /* void */ }

};

//============================================================================
#if ODO_OS_LINUX == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ProcessFactory<ODO_OS_LINUX> : public OsComponentFactoryIF<ProcessIF> {

public: // iface

	virtual std::auto_ptr<ProcessIF> getComponent() {
		return std::auto_ptr<ProcessIF>(new ProcessLinux());
	}

public: // factory

	virtual ~ProcessFactory() { /* void */ }
	ProcessFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_LINUX */
//============================================================================
#if ODO_OS_VISTA == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ProcessFactory<ODO_OS_VISTA> : public OsComponentFactoryIF<ProcessIF> {

public: // iface

	virtual std::auto_ptr<ProcessIF> getComponent() {
		return std::auto_ptr<ProcessIF>(new ProcessVista());
	}

public: // factory

	virtual ~ProcessFactory() { /* void */ }
	ProcessFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_VISTA */
//============================================================================

}

#endif /* PROCESS_FACTORY_HPP */
